<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
<title>智能门禁通过记录</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" href="/resources/weui/lib/weui.min.css">
<link rel="stylesheet" href="/resources/weui/css/jquery-weui.css">
<link rel="stylesheet" href="/resources/weui/css/demos.css">

</head>

<body ontouchstart>
	<header class='demos-header'>
		<p class="demos-title" style="font-size: 27px">智能门禁通过记录</p>
	</header>

	<div class="weui-cells__title" style="color: red">时间/楼号/是否通过</div>
	<div class="weui-cells">
		<form action="/wechat/access_record/list" method="get" id="findForm">
			<div class="weui-cell weui-cell_select weui-cell_select-after">
				<div class="weui-cell__bd">
					<select class="weui-select" name="time" id="time">
						<option value="1">今天</option>
						<option value="2">最近3天</option>
						<option value="3">最近7天</option>
					</select>
				</div>
				<div class="weui-cell__bd">
					<select class="weui-select" name="buildingNumber"
						id="buildingNumber">
						<option value="0">全部</option>
						<option value="1">1号楼</option>
						<option value="2">2号楼</option>
						<option value="3">3号楼</option>
						<option value="4">4号楼</option>
						<option value="5">5号楼</option>
					</select>
				</div>
				<div class="weui-cell__bd">
					<select class="weui-select" name="state" id="state">
						<option value="0">全部</option>
						<option value="1">通过门禁</option>
						<option value="2">未通过门禁</option>
					</select>
				</div>
			</div>
		</form>
	</div>
	<div class="weui-cells__title">查询结果</div>
	<div id="list" class="weui-cells">
		<c:forEach var="accessRecord" items="${accessRecordList}">
			<a class="weui-cell weui-cell_access"
				href="/access_record_details/${accessRecord.id}">
				<div class="weui-cell__hd">
					<img src="${accessRecord.type==1 ? "/resources/images/sign-check-icon.png" : "/resources/images/sign-ban-icon.png"}" alt=""
						style="width:20px;margin-right:5px;display:block">
				</div>
				<div class="weui-cell__bd">
					<p>${accessRecord.student eq null ? "未知" : accessRecord.student.name}&nbsp;-&nbsp;${accessRecord.student eq null ? "未知" : accessRecord.student.roomNumber}</p>
				</div>
				<div class="weui-cell__ft">
					<fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss"
						value="${accessRecord.accessTime}" />
				</div>
			</a>
		</c:forEach>
	</div>
	</div>
	<div class="weui-loadmore">
		<i class="weui-loading"></i> <span class="weui-loadmore__tips">正在加载</span>
	</div>
	<script src="/resources/weui/lib/jquery-2.1.4.js"></script>
	<script src="/resources/weui/lib/fastclick.js"></script>
	<script src="/resources/weui/js/jquery-weui.js"></script>
	<script>
		$(function() {
			FastClick.attach(document.body);
			$("#time").find("option[value='${time eq null?1:time}']").attr("selected", "selected");
			$("#buildingNumber").find("option[value='${buildingNumber eq null?1:buildingNumber}']").attr("selected", "selected");
			$("#state").find("option[value='${state eq null?1:state}']").attr("selected", "selected");
			$(".weui-select").change(function() {
				$("#findForm").submit();
			});
		});
	</script>
</body>
</html>
